package com.yn.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum BooleanEnum {

	YES(1, "是"),

	NO(0, "否"),

	;

	private Integer code;

	private String name;

	public static BooleanEnum getByCode(Integer code) {
		if(null == code) {
			return null;
		}
		for(BooleanEnum booleanEnum : BooleanEnum.values()) {
			if(booleanEnum.getCode() == code) {
				return booleanEnum;
			}
		}
		return null;
	}

}
